#pragma once
/*
 * Copyright (c) 2011 Robert Kirchgessner <rkirchge@gmail.com>
 *                    Carlo Pascoe <carlo.pascoe@gmail.com>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef _HASHGRAPH_H_
#define _HASHGRAPH_H_

#include <sys/queue.h>
#include <stdint.h>
#include "subgraphoverlay.h"

typedef uint32_t hash_type;

struct hash_graph {
  uint32_t size;
  uint32_t *hash_edges;
  uint32_t *hash_adj;
  hash_type *hash_array;
  struct subgraph **subgraph_array;
};


void hash_init(struct hash_graph *hg, struct overlaygraph *og, void (*hash_func)(struct subgraph *sg, hash_type *hash, uint32_t feature_size), uint32_t feature_size);
uint32_t hash_dist(hash_type h1, hash_type h2);

void hash_write_dotty(const char *fname, struct hash_graph *hg); 

void hash_write_dotty_align(const char *fname, uint32_t *map_hg, struct hash_graph *hg, uint32_t *map_q, struct hash_graph *hgq);
void hash_cleanup(struct hash_graph *hg);

#endif /*_HASHGRAPH_H_*/

